package com.edu.demo.utils;

import com.edu.demo.constant.UserConstant;
import com.edu.demo.entity.LoginUser;

/**
 * @ClassName: UserUtils
 * @Description:
 * @Author: jxw
 * @Date: 2023-01-29
 */
public class UserUtils {

    public static final String getUserName(LoginUser user){
        String type = user.getType();
        switch (type){
            case UserConstant
                    .ADMIN_TYPE:
                return user.getSysUser().getName();
            case UserConstant
                    .TEACHER_TYPE:
                return user.getTeacher().getName();
            case UserConstant
                    .STUDENT_TYPE:
                return user.getStudent().getName();
        }

        return "";
    }


}
